home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
spoc88
/
tbtasm
/
tbmax.asm
< prev
next >
Wrap
Assembly Source File
|
1988-06-14
|
795b
|
25 lines
;TBMAX.ASM Routine to find max value in integer array
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
PUSH BP ;Save BP
MOV BP,SP ;Get stack address
;Get the arguments
LES BX,[BP+06H] ;Get addr of array count
MOV CX,ES:[BX] ;Put count in CX
LES DI,[BP+0AH] ;Get addr of first element
LES BX,[BP+0EH] ;Get addr of return value
;Find the max value
MOV AX,ES:[DI] ;Get first array element
A: CMP AX,ES:[DI+2] ;Compare present with next
JG B
MOV AX,ES:[DI+2] ;Put new, larger value in AX
B: INC DI
INC DI
LOOP A
MOV ES:[BX],AX ;Store max value
;Clean up and leave
QUIT: POP BP ;Restore BP
CODE ENDS
END